layui.use(['layer', 'form', 'admin', 'laydate', 'ax','func', 'formSelects'], function () {
    var $ = layui.jquery;
    var $ax = layui.ax;
    var form = layui.form;
    var admin = layui.admin;
    var func = layui.func;

    $(document).on('click', '#btnOpen', function(data) {
    	var agentId  = $("#agentId").val();
    	var userId  = $("#userId").val();
    	var pushId  = $("#pushId").val();
    	layer.confirm('确定要通过吗?', function() {
			var data = {
					agentId : agentId,
					userId : userId,
					pushId : pushId,
					isAudit : 1
				};
			//调用ajax局部启动
			$.ajax({
				url : Feng.ctxPath + "/modular/agent/update",
				type : "POST",
				data :JSON.stringify(data),
				dataType : "json",
				contentType: "application/json;charset=UTF-8",
				async : false,
				cache : false,
				success : function(obj) {
					if (obj != null) {
						if (obj.success) {
							layer.msg("操作成功");
						} else {
							layer.msg("操作失败");
						}
					}
                    admin.putTempData('formOk', true);
                    //关掉对话框
                    admin.closeThisDialog();
				}
			});
			setTimeout("layer.close(layer.index);",2000);
		});
    });
    $(document).on('click', '#btnOpens', function(data) {
     	var agentId  = $("#agentId").val();
     	var pushId  = $("#pushId").val();
    	 func.open({
	            type: 2,
	            shadeClose: true,
	            shade: 0.5,
	            area: '300px',
	            title: '审核拒绝',
	            maxmin: true, //开启最大化最小化按钮
	            content: Feng.ctxPath + "/modular/agent/refuse?agentId="+agentId+"&pushId="+pushId
	        });
    });

});
